$(function () {
	vm.getKuaibao();
	vm.getManager();
    vm.getMentor();
    vm.getBsnstudentList();
});

var vm = new Vue({
    el: '#mapp',
    data: {
        announcement: '',
        bsnManager:{},
        bsnMentor:{},
        bsnStudentList: [],
        teacherNotice: '导师须知：导师应遵守平台的各项管理规定，不可随意取消预约等',
		pageParams: {
			limit: "100",
			page: "1"
		}
    },
    methods: {
    	getKuaibao: function() {
			$.get(ajaxServerUrlG("bsnKb/lastKb"), function(r){
				if (r.code == 0) {
                	vm.announcement = r.kb;
				}
            });
    	},
        getBsnstudentList: function () {
            $.ajax({
                type: "POST",
                url: ajaxServerUrlG("bsnstudent/listByMentor"),
                contentType: "application/json",
                data: JSON.stringify(vm.pageParams),
                success: function (r) {
                    if (r.code === 0) {
                        vm.bsnStudentList = r.page.list;
                    } else {
                        alert(r.msg);
                    }
                }
            });
        },
		//获取导师信息
		getMentor: function(){
			$.get(ajaxServerUrlG("bsnmentor/infoBylogin"), function(r){
				if (r.code == 0) {
					if (r.bsnMentor) {
                		vm.bsnMentor = r.bsnMentor;
					}
				}
            });
		},
		//获取秘书信息
		getManager: function(){
			$.get(ajaxServerUrlG("bsnmentor/managerInfo"), function(r){
				if (r.code == 0) {
					if (r.bsnManager) {
                		vm.bsnManager = r.bsnManager;
					}
				}
            });
		},
        gotoStudentInfo: function (studentId) {
            location.href = "comStudentInfo.html?id=" + studentId + "&title=学生信息";
        }
    },
    filters: {
        /*过滤并替换头像 */
        imgFilter: function (imgUrl, xingb) {
            if (StringUtils.isNotEmpty(imgUrl)) {
                return imgUrl;
            }
            if (xingb == "男") {
                return "images/man@2x.png";
            } else {
                return "images/woman@2x.png";
            }
        }
    }
});

